﻿@model mitasoft.Web.DAL.Model.Book
<script type="text/javascript">
    $(document).ready(function () {

        $("#CoverUrl").change(function () {
            SetImage();
        });

        SetImage();
    });


    function SetImage() {
        var currentUrl = $("#CoverUrl").val();

        if (currentUrl.length > 0) {
            $('#coverPic')
                .attr("src", currentUrl)
                .css("visibility", "visible");
        }
        else {
            $('#coverPic').css("visibility", "hidden");
        }
    }
</script>
@Html.HiddenFor(model => model.Id)
@Html.HiddenFor(model =>model.AddDate)
<div class="editor-label">
    @Html.LabelFor(model => model.Title)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Title)
    @Html.ValidationMessageFor(model => model.Title)
</div>
<div class="editor-label">
    @Html.LabelFor(model => model.CoverUrl)
</div>
<div class="editor-field">
    @Html.TextAreaFor(model => model.CoverUrl, new { rows = "5" })
    @Html.ValidationMessageFor(model => model.CoverUrl)
</div>
<br />
<img id="coverPic" alt="coverImg" style="visibility: hidden" />
